using System;
using System.Collections.Generic;
using NKestrelClient.Kestrel;
using System.Text;

namespace NKestrelClient.Memcache {
	class Example {
		public static void Main(string[] args) {
            MemcachedClient.Setup("kestrel", new string[] { "127.0.0.1:22133" });

            var kestrel = new KestrelClient(MemcachedClient.GetInstance("kestrel"));

            using (var channel = kestrel.GetChannel("foo"))
            {
                var data = channel.Get("foo");
                Console.WriteLine(data == null ? "[null]" : Encoding.UTF8.GetString(data));
                channel.Set("foo", Encoding.UTF8.GetBytes("qwerty"));
                channel.Set("foo", Encoding.UTF8.GetBytes("shai"));
                data = channel.Get("foo");
                Console.WriteLine(data == null ? "[null]" : Encoding.UTF8.GetString(data));
                data = channel.Get("foo");
                Console.WriteLine(data == null ? "[null]" : Encoding.UTF8.GetString(data));
                data = channel.Get("foo");
                Console.WriteLine(data == null ? "[null]" : Encoding.UTF8.GetString(data));
            }

            Console.ReadLine();
		}
	}
}
